<%@ page language="java" import="java.util.*,java.sql.*"
	contentType="text/html; charset=utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<jsp:useBean id="db" class="connBean.ConnDB" scope="page" />

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>欧米购商城-个人资料</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">


		<link rel="stylesheet" href="css/style.css" type="text/css"
			media="all" />
		<!--[if lte IE 6]><link rel="stylesheet" href="css/ie6.css" type="text/css" media="all" /><![endif]-->

		<meta name="keywwords"
			content="Shop Around - Great free html template for on-line shop. Use it as a start point for your on line business. The template can be easily implemented in many open source E-commerce platforms" />
		<meta name="description"
			content="Shop Around - Great free html template for on-line shop. Use it as a start point for your on line business. The template can be easily implemented in many open source E-commerce platforms" />

		<!-- JS -->
		<script src="js/jquery-1.4.1.min.js" type="text/javascript">
</script>
		<script src="js/jquery.jcarousel.pack.js" type="text/javascript">
</script>
		<script src="js/jquery-func.js" type="text/javascript">
</script>
		<!-- End JS -->


		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>
	<body>
		<%
			request.setCharacterEncoding("UTF-8");
		%>
		<jsp:include page="customerService.jsp"></jsp:include>
		<!-- Shell -->
		<div class="shell">

			<!-- Header -->
			<div id="header">
				<h1 id="logo">
					<a href="index.jsp">欧米购</a>
				</h1>
				<!-- Cart -->
				<div id="cart" align="center">
					<%
						if (session.getAttribute("username") == null
								|| session.getAttribute("username") == "") {
					%>您好，您还未登录！
					<div class="cl">
						&nbsp;
					</div>
					<a href="login.jsp" class="c2-link">[登录]</a>
					<a href="addUser.jsp" class="c2-link">[免费注册]</a>
					<%
						} else {
					%>欢迎您，<%=session.getAttribute("username")%>
					<a href="logout.jsp" class="c2-link">[退出]</a>
					<div class="cl">
						&nbsp;
					</div>
					<a href="personalData.jsp" class="c2-link">个人资料</a>
					<a href="shoppingCart.jsp" class="cart-link">我的购物车</a>
					<%
						}
					%>
				</div>
				<!-- End Cart -->

				<!-- Navigation -->
				<div id="navigation">
					<ul>
						<li>
							<a href="index.jsp">主页</a>
						</li>
						<%
							db.OpenConn();
							db.createStmt();
							String sql = "select * from main_type";
							ResultSet rs = db.Query(sql);
							while (rs.next()) {
						%>
						<li>
							<a href="index_main_Type.jsp?maintype_id=<%=rs.getInt("t_id")%>"><%=rs.getString("t_name")%></a>
						</li>
						<%
							}
							db.closeStmt();
							db.closeConn();
						%>
					</ul>
				</div>
				<!-- End Navigation -->
			</div>
			<!-- End Header -->

			<!-- Main -->
			<div id="main">
				<div class="cl">
					&nbsp;
				</div>

				<!-- Content -->
				<div id="content">
					<!-- PersonalData -->
					<div class="box categories">
						<h2>个人收藏夹
							<span></span>
						</h2>
						<div class="box-content">
							<form>
								<table width="100%">
									<tr>
										<td>
											商品号
										</td>
										<td>
											商品名
										</td>
										<td>
											商品图片
										</td>
										<td>
											操作
										</td>
									</tr>
									<%
										String username = (String) session.getAttribute("username");

										String sql1 = "select * from customer where c_name=" + "'"
												+ username + "'";
										db.OpenConn();
										db.createStmt();
										ResultSet userrs = db.Query(sql1);
										int c_id = 0;
										if (userrs.next()) {
											c_id = userrs.getInt("c_id");
											db.closeStmt();
											db.closeConn();
										}

										String fasql = "SELECT a.c_id,a.p_id,b.p_name,b.p_image,b.p_price FROM favorite as a left join product as b on a.p_id=b.p_id where c_id="
												+ c_id;
										System.out.println();
										System.out.println(fasql);
										db.OpenConn();
										db.createStmt();
										ResultSet fars = db.Query(fasql);
										while (fars.next()) {
											String p_id = fars.getString("p_id");
									%>
									<tr>
										<td><%=p_id%></td>
										<td>
											<a href="index_ProductDetail.jsp?p_id=<%=p_id%>" /><%=fars.getString("p_name")%></a>
										</td>
										<td>
											<%
												String image = fars.getString("p_image");
													String a[] = image.split(";");
											%>



											<a href="index_ProductDetail.jsp?p_id=<%=p_id%>" /><img
													src="images/<%=a[0]%>" width=100 height=100 />
											</a>

										</td>
										<td>
											<a href="deleteFavorite.jsp?p_id=<%=p_id%>&c_id=<%=c_id%>">删除</a>
										</td>

									</tr>
									<%
										}
									%>





								</table>








							</form>
						</div>
					</div>
					<!-- End PersonalData -->
				</div>
				<!-- End Content -->

				<!-- Sidebar -->
				<div id="sidebar">

					<!-- PersonalData -->
					<div class="box categories">
						<h2>
							全部功能
							<span></span>
						</h2>
						<div class="box-content">
							<ul>
								<li>
									<a href="personalData_Orders.jsp">我的订单</a>
								</li>
								<li>
									<a href="personalData_Datas.jsp">我的资料</a>
								</li>
								<li>
									<a href="personalData_UpdatePwd.jsp">修改密码</a>
								</li>
								<li>
									<a href="personalData_Favorite.jsp">个人收藏夹</a>
								</li>
							</ul>
						</div>
					</div>
					<!-- End PersonalData -->

				</div>
				<!-- End Sidebar -->

				<div class="cl">
					&nbsp;
				</div>
			</div>
			<!-- End Main -->

			<!-- Side Full -->
			<div class="side-full">

				<!-- More Products -->
				<div class="more-products">
					<div class="more-products-holder">
						<ul>
							<li>
								<a href="#"><img src="images/small1.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small2.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small3.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small4.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small5.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small6.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small7.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small1.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small2.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small3.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small4.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small5.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small6.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small7.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small1.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small2.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small3.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small4.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small5.jpg" alt="" />
								</a>
							</li>
							<li>
								<a href="#"><img src="images/small6.jpg" alt="" />
								</a>
							</li>
							<li class="last">
								<a href="#"><img src="images/small7.jpg" alt="" />
								</a>
							</li>
						</ul>
					</div>
					<div class="more-nav">
						<a href="#" class="prev">previous</a>
						<a href="#" class="next">next</a>
					</div>
				</div>
				<!-- End More Products -->

				<!-- Text Cols -->
				<div class="cols">
					<div class="cl">
						&nbsp;
					</div>
					<div class="col">
						<h3 class="ico ico1">
							Donec imperdiet
						</h3>
						<p>
							Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
							imperdiet, metus ac cursus auctor, arcu felis ornare dui.
						</p>
						<p class="more">
							<a href="#" class="bul">Lorem ipsum</a>
						</p>
					</div>
					<div class="col">
						<h3 class="ico ico2">
							Donec imperdiet
						</h3>
						<p>
							Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
							imperdiet, metus ac cursus auctor, arcu felis ornare dui.
						</p>
						<p class="more">
							<a href="#" class="bul">Lorem ipsum</a>
						</p>
					</div>
					<div class="col">
						<h3 class="ico ico3">
							Donec imperdiet
						</h3>
						<p>
							Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
							imperdiet, metus ac cursus auctor, arcu felis ornare dui.
						</p>
						<p class="more">
							<a href="#" class="bul">Lorem ipsum</a>
						</p>
					</div>
					<div class="col col-last">
						<h3 class="ico ico4">
							Donec imperdiet
						</h3>
						<p>
							Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
							imperdiet, metus ac cursus auctor, arcu felis ornare dui.
						</p>
						<p class="more">
							<a href="#" class="bul">Lorem ipsum</a>
						</p>
					</div>
					<div class="cl">
						&nbsp;
					</div>
				</div>
				<!-- End Text Cols -->

			</div>
			<!-- End Side Full -->

			<!-- Footer -->
			<div id="footer">
				<p class="left">
					<a href="index.jsp">Home</a>
					<span>|</span>
					<a href="#">Support</a>
					<span>|</span>
					<a href="#">My Account</a>
					<span>|</span>
					<a href="#">The Store</a>
					<span>|</span>
					<a href="#">Contact</a>
				</p>
				<p class="right">
					&copy; 2015 OMEGO Shopping Design by &nbsp;
					<a href="#" target="_blank"
						title="The Sweetest CSS Templates WorldWide">欧米购创意小组</a>
				</p>
			</div>
			<!-- End Footer -->

		</div>
		<!-- End Shell -->


	</body>
</html>
